body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  box-sizing: border-box;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 800px;
  width: 100%;
}

h1 {
  margin-bottom: 20px;
  text-align: center;
}

#game-board {
  display: grid;
  gap: 1px;
  background-color: #ccc;
  border: 1px solid #999;
  padding: 0;
  box-sizing: content-box;
  margin-bottom: 20px;
}

#game-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 600px;
  gap: 10px; /* 使用与按钮相同的间距 */
}

#game-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 10px; /* 与按钮间距相同 */
}

#game-stats div {
  margin-bottom: 5px;
}

#game-buttons {
  display: flex;
  gap: 10px;
}

button, select {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

@media (max-width: 600px) {
  #game-controls {
    flex-direction: column;
    align-items: center;
  }

  #game-stats {
    margin-right: 0;
    margin-bottom: 10px;
    align-items: center;
  }

  #game-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.tile {
  width: var(--tile-size, 40px);
  height: var(--tile-size, 40px);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: var(--font-size, 20px);
  background-color: white;
  transition: all 0.3s ease;
  user-select: none;
}

.tile.selected {
  background-color: #e0e0e0;
  border-color: #666;
}

button, select {
  padding: 10px 15px;
  font-size: 16px;
  cursor: pointer;
  margin: 5px;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}

@media (max-width: 600px) {
  #game-info {
    flex-direction: column;
    align-items: center;
  }
  
  .tile {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  
  #game-controls {
    flex-direction: column;
    align-items: center;
  }
  
  #game-info {
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
  }
  
  #game-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.tile.matched {
  transform: scale(0);
  opacity: 0;
}

.tile:hover {
  transform: scale(1.05);
}

.tile.error {
  background-color: #ffcccc;
  border-color: #ff0000;
}

/* 删除之前的自定义光标相关样式 */

.connection-line {
  position: absolute;
  height: 4px;
  background-color: #ff0000;
  transform-origin: left center;
}

/* ... 保留之后的样式 ... */

#game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 24px;
  z-index: 1000;
}

#game-over-screen h2 {
  font-size: 36px;
  margin-bottom: 20px;
}

#game-over-screen p {
  margin: 10px 0;
}

.combo-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: #ff0000;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

#pause-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 24px;
  z-index: 1000;
}

.hint {
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

#game-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#game-stats div {
  margin-bottom: 5px;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}